package com.zl.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.system.common.mapper.BisNurseProjectMapper;
import com.system.common.pojo.BisCustomUser;
import com.system.common.pojo.BisNurseProject;
import com.system.common.pojo.BisNurseProjectExample;
import com.system.common.pojo.BisNurseProjectExample.Criteria;


@Service
public class ZlBisNurseProjectServiceImpl implements ZlBisNurseProjectService{
    
	
	@Autowired
	private BisNurseProjectMapper bisNurseProjectMapper;
	
	@Override
	public List<BisNurseProject> selectByExampleWithBLOBs(BisNurseProjectExample example) {
		// TODO Auto-generated method stub
		return bisNurseProjectMapper.selectByExampleWithBLOBs(example);
	}

	@Override
	public List<BisNurseProject> selectByExample(Map<String, Object> map) {
		
		BisNurseProjectExample example=new BisNurseProjectExample();
		Criteria criteria=example.createCriteria();
		criteria.andStatusEqualTo("1");
		criteria.andIsDelEqualTo("0");
		
		return bisNurseProjectMapper.selectByExample(example);
	}

	

	@Override
	public BisNurseProject selectByPrimaryKey(String projectId) {
		// TODO Auto-generated method stub
		return bisNurseProjectMapper.selectByPrimaryKey(projectId);
	}

	@Override
	public List<BisNurseProject> selectByBagId(BisCustomUser bisCustomUser,HttpServletRequest request) {
		Map<String, Object> map=new HashMap<>();
		String state=request.getParameter("projectStatus");
		String bagId=request.getParameter("bagId");
		map.put("state", state);
		map.put("userId", bisCustomUser.getCustomUserId());

		List<BisNurseProject> bisList;
		if (bagId.equals("0")){
			 bisList=bisNurseProjectMapper.selectUserBagProject(map);
		}else {
			 bisList=bisNurseProjectMapper.selectUserBagIdProject(bagId);
		}
		System.out.println(bagId+"<><>");





		return bisList;
	}

	
}
